package com.sailmi.system.feign;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sailmi.common.tool.api.R;
import com.sailmi.system.entity.UserEnterprise;
import com.sailmi.system.service.impl.UserEnterpriseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/enterprise")
public class UserEnterpriseFeignController implements IuserEnterRelationFeign {
	@Autowired
	private UserEnterpriseServiceImpl userEnterpriseServiceImpl;

	@Override
	@GetMapping( "/userenterlist")
	public R<List<UserEnterprise>> detailInfo(String enterpriseId, Boolean flag) {
		QueryWrapper<UserEnterprise> userEnterpriseQueryWrapper = new QueryWrapper<>();
		userEnterpriseQueryWrapper.eq("enterprise_id",enterpriseId);
		if(flag){
			userEnterpriseQueryWrapper.eq("status",1);//查询管理员列表
		}
		List<UserEnterprise> list = userEnterpriseServiceImpl.list(userEnterpriseQueryWrapper);
		return R.data(list);
	}
}
